package J1_10;

import java.util.Scanner;

public class J110task1 {
    public static void main(String[] args) {
        int s,j=0,w;
        float f=0.0f;
        int a[];
        float b[];
        Scanner scanner =new Scanner(System.in);
        System.out.printf("请固定数组长度:");
        w=scanner.nextInt();
        a=new int[w];
        System.out.print("请输入一个数,按这个数求平均值:");
        s=scanner.nextInt();
        if(w%s==0){
            b=new float[w/s];
        }else {
            b=new float[w/s+1];
        }
        for (int i=0;i<a.length;i++){
                a[i]=(i+1)*2;
        }
        int t=0;//累加次数
        for (int i=0;i<a.length;i++){
          if(t==s){
              b[j++]=f/t;
              f=0.0f;
              t=0;
          }
          f=f+a[i];
          t++;
        }
        b[j++]=f/t;
        for (int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }
    }
}
